package geez.widget;

import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.Label;

import static geez.widget.Geez.withStyle;

public class GLabel extends Label implements GWidget, GTextSetable {

    public GLabel() {
        super();
    }

    public GLabel(String text) {
        super(text);
    }

    public GLabel(String text, boolean wordWrap) {
        super(text, wordWrap);
    }

    public GLabel id(String id) {
        Geez.withNameAndId(this, id);
        return this;
    }

    public GLabel css(String cssClass, String... optionalClasses) {
        withStyle(this, cssClass, optionalClasses);
        return this;
    }

    public GLabel style(String styleKey, String styleAttribute) {
        DOM.setStyleAttribute(getElement(), styleKey, styleAttribute);
        return this;
    }

    public GLabel text(String text) {
        setText(text);
        return this;
    }

    public GLabel hide() {
        setVisible(false);
        return this;
    }

    public GLabel show() {
        setVisible(true);
        return this;
    }
}
